package com.wyp168.juc;

import org.apache.logging.log4j.ThreadContext;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @ClassName ThreadContextDemo001
 * @Description TODO
 * @Author wyp168
 * @Date 2022/8/12 09:39
 */
public class ThreadContextDemo001 {

    public static void main(String[] args) {
        List<String> stackValue = new ArrayList<>();
        stackValue.add("123");
        stackValue.add("456");
        //将stackValue 对象放到ThreadContext的Stack中去
        ThreadContext.setStack(stackValue);
        Map<String, String> context = ThreadContext.getContext();
        if (!CollectionUtils.isEmpty(context.values())) {
            System.out.println(context.values());
        }
    }
}
